<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //新建一个字符串
        var lin = 'helloworld我爱你!'
        //定义函数
        function reversestring1(lin) {
            //新建一个空字符串
            var newlin = "";
            //for循环遍历
            for (var i = lin.length - 1; i >= 0; i--) {
                //吧替换好的字符串赋值给空字符串
                newlin += lin[i].replace('!','啊').replace('w','W').replace('h','H');
            }
            return newlin;
        }
        //控制台输出结果
        console.log(reversestring1(lin))
    </script>
</body>

</html>